home *** CD-ROM | disk | FTP | other *** search
/ Your Web Site Creator / Your Web Site Creator.iso / WebSite / data1.cab / Program_Executable_Files / Classes / HDSPANE2.CLA (.txt) < prev    next >
Encoding:
Java Class File  |  1999-01-13  |  2.7 KB  |  97 lines

  1. import java.applet.Applet;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Graphics;
  5. import java.awt.Image;
  6. import java.awt.image.ImageObserver;
  7.  
  8. public class HDSBorderPanel2 extends DynamicBorderPanel2 {
  9.    Color activeColor;
  10.    Color inactiveColor;
  11.    int activeColorIndex;
  12.    Image osImage;
  13.    Graphics osg;
  14.    int newThickness;
  15.    int index;
  16.    int sections;
  17.    boolean showLights;
  18.    int currentX;
  19.  
  20.    void GetParameters(Applet var1, int var2) {
  21.       String var3 = var1.getParameter("hdsBorderThickness" + var2);
  22.       ((BorderPanel2)this).SetThickness(AppletParam2.GetInt(var3, 6));
  23.       var3 = var1.getParameter("hdsBorderBkColor" + var2);
  24.       ((BorderPanel2)this).SetBackgroundColor(AppletParam2.GetColor(var3, (Color)null));
  25.       var3 = var1.getParameter("hdsBorderBkImage" + var2);
  26.       ((BorderPanel2)this).SetBackgroundImage(AppletParam2.GetImage(var1, var3));
  27.       var3 = var1.getParameter("hdsBorderActiveColor" + var2);
  28.       this.SetActiveColor(AppletParam2.GetColor(var3, Color.red));
  29.       var3 = var1.getParameter("hdsBorderInactiveColor" + var2);
  30.       this.SetInactiveColor(AppletParam2.GetColor(var3, Color.yellow));
  31.       var3 = var1.getParameter("hdsBorderSectionCount" + var2);
  32.       this.SetSectionCount(AppletParam2.GetInt(var3, 3));
  33.    }
  34.  
  35.    public HDSBorderPanel2(Applet var1, int var2) {
  36.       this.activeColor = Color.red;
  37.       this.inactiveColor = Color.yellow;
  38.       this.sections = 3;
  39.       this.showLights = false;
  40.       this.GetParameters(var1, var2);
  41.    }
  42.  
  43.    public void SetActiveColor(Color var1) {
  44.       this.activeColor = var1;
  45.    }
  46.  
  47.    public void SetInactiveColor(Color var1) {
  48.       this.inactiveColor = var1;
  49.    }
  50.  
  51.    public void SetSectionCount(int var1) {
  52.       this.sections = var1;
  53.    }
  54.  
  55.    public void DoPaint(Graphics var1) {
  56.       if (this.osImage == null) {
  57.          this.osImage = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
  58.          this.osg = this.osImage.getGraphics();
  59.       }
  60.  
  61.       if (this.showLights) {
  62.          this.osg.setColor(Color.black);
  63.  
  64.          for(int var2 = 0; var2 < this.sections; ++var2) {
  65.             while(this.currentX < ((Component)this).size().width) {
  66.                this.osg.fillOval(this.currentX + var2 * this.newThickness, var2 * this.newThickness, this.newThickness, this.newThickness);
  67.                this.currentX += this.newThickness + 1;
  68.             }
  69.          }
  70.       } else {
  71.          for(int var3 = 0; var3 < super.thickness; ++var3) {
  72.             this.index = var3 / this.newThickness;
  73.             if (this.index == this.activeColorIndex) {
  74.                this.osg.setColor(this.activeColor);
  75.             } else {
  76.                this.osg.setColor(this.inactiveColor);
  77.             }
  78.  
  79.             this.osg.drawRect(var3, var3, ((Component)this).size().width - var3 * 2, ((Component)this).size().height - var3 * 2);
  80.          }
  81.       }
  82.  
  83.       ++this.activeColorIndex;
  84.       if (this.activeColorIndex >= this.sections) {
  85.          this.activeColorIndex = 0;
  86.       }
  87.  
  88.       var1.drawImage(this.osImage, 0, 0, (ImageObserver)null);
  89.    }
  90.  
  91.    void DoResize(int var1, int var2) {
  92.       this.osImage = null;
  93.       this.osg = null;
  94.       this.newThickness = super.thickness / this.sections;
  95.    }
  96. }
  97.